package com.wt.springsamples.collections;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

public class MapTest {

    public static void processMap(Map map){
//        map = new HashMap();
        map.put(1,20);
    }

    public static void main(String[] args) throws InterruptedException {
        Map map = new HashMap();
        map.put(1,10);
        processMap(map);
        System.out.println("Map===>"+map.get(1));

        int n = 19; //10011,  16+8+4+1   11101
        System.out.println( n >> 2);
        System.out.println( n >>> 2);
        System.out.println( n - (n >>> 2));//10011  -  00100

        System.out.println(n + (n >>> 1) + 1);
        HashMap hmap = new HashMap<>();
        hmap.put("k1","v1");
        hmap.get("k1");
        hmap.size();

        Hashtable htable = new Hashtable<>();
        htable.put("k1","v1");
        htable.get("k1");
        htable.size();

        ConcurrentHashMap cmap = new ConcurrentHashMap();

        for(int i=0;;i++){
            Thread.sleep(1000L);
            String key = "key"+i;
            String value = "value"+i;
            System.out.println("key=>>"+key);
            cmap.put(key,value);
        }
//        cmap.get("k1");
//        cmap.size();
//
//        TreeMap tMap = new TreeMap();
//        tMap.put("k1","v1");
//        tMap.get("k1");
//        tMap.size();
    }
}
